import Vue from 'vue'
import VueRouter from 'vue-router'

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)

const routes = [

  {
    path: '/',
    component: () => import('@/views/Fan'),
  },
  {
    path: '/Login',
    component: () => import('@/views/Login'),
  }, {
    path: '/AssLogin',
    component: () => import('@/views/Assistant/AssisLogin'),
  },
  {
    path: '/ManagerLogin',
    component: () => import('@/views/Manager/ManagerLogin'),
  },
  {
    path: '/UserRegister',
    component: () => import('@/views/User/RegisterUser'),
  },
  {
    path: '/ManagerHome',
    component: () => import('@/views/Manager/ManagerHome'),
    children: [
      {
        path: '/ManagerHome/UpdatePwd',
        component: () => import('@/views/Manager/UpdateAnyPsd'),
      }, {
        path: '/ManagerHome/UserList',
        component: () => import('@/views/User/UserList'),
      }, {
        path: '/ManagerHome/FindUser',
        component: () => import('@/views/User/FindUser'),
      }, {
        path: '/ManagerHome/UpdateUser',
        component: () => import('@/views/User/UpdateUser'),
      }, {
        path: '/ManagerHome/RegisterUser',
        component: () => import('@/views/User/RegisterUser'),
      }, {
        path: '/ManagerHome/AssistantInfo',
        component: () => import('@/views/Assistant/AssistantInfo'),
      }, {
        path: '/ManagerHome/FindAssistant',
        component: () => import('@/views/Assistant/FindAssistant'),
      }, {
        path: '/ManagerHome/RegisterAssistant',
        component: () => import('@/views/Assistant/RegisterAssistant'),
      }, {
        path: '/ManagerHome/AddSalary',
        component: () => import('@/views/Assistant/AddSalary'),
      }, {
        path: '/ManagerHome/OlderInfo',
        component: () => import('@/views/Older/OlderInfo'),
      }, {
        path: '/ManagerHome/FindOlderInfo',
        component: () => import('@/views/Older/FindOlderInfo'),
      }, {
        path: '/ManagerHome/RegisterOlder',
        component: () => import('@/views/Older/RegisterOlder'),
      }, {
        path: '/ManagerHome/BedInfo',
        component: () => import('@/views/Bed/BedInfo'),
      }, {
        path: '/ManagerHome/Question',
        component: () => import('@/views/Quest'),
      }, {
        path: '/ManagerHome/UnuseBed',
        component: () => import('@/views/Bed/UnuseBed'),
      }, {
        path: '/ManagerHome/InQuestionMa',
        component: () => import('@/views/InsertQuest'),
      }, {
        path: '/ManagerHome/SundayList',
        component: () => import('@/views/Assistant/SundayList'),
      },
    ]
  },
  {
    path: '/AssisHome',
    component: () => import('@/views/Assistant/AssisHome'),
    children: [
      {
        path: '/AssisHome/UpdatePwd',
        component: () => import('@/views/Assistant/UpdatePsd'),
      }, {
        path: '/AssisHome/AssistantInfo',
        component: () => import('@/views/Assistant/AssistantInfo'),
      }, {
        path: '/AssisHome/UpdateAssis',
        component: () => import('@/views/Assistant/UpdateAssis'),
      }, {
        path: '/AssisHome/FindAssistant',
        component: () => import('@/views/Assistant/FindAssistant'),
      }, {
        path: '/AssisHome/BedInfo',
        component: () => import('@/views/Bed/BedInfo'),
      }, {
        path: '/AssisHome/OlderInfo',
        component: () => import('@/views/Older/OlderInfo'),
      }, {
        path: '/AssisHome/salary',
        component: () => import('@/views/Assistant/salary'),
      }, {
        path: '/AssisHome/Question',
        component: () => import('@/views/Quest'),
      }, {
        path: '/AssisHome/InQuestion',
        component: () => import('@/views/InsertQuest'),
      }, {
        path: '/AssisHome/UnuseBed',
        component: () => import('@/views/Bed/UnuseBed'),
      }, {
        path: '/AssisHome/SundayList',
        component: () => import('@/views/Assistant/SundayList'),
      }, {
        path: '/AssisHome/Sunday',
        component: () => import('@/views/Assistant/Sunday'),
      },
    ]
  },
  {
    path: '/Home',
    component: () => import('@/views/Home'),
    children: [
      {
        path: '/Home/UpdatePwd',
        component: () => import('@/views/User/UpdatePwd'),
      }, {
        path: '/Home/UserList',
        component: () => import('@/views/User/UserList'),
      }, {
        path: '/Home/FindUser',
        component: () => import('@/views/User/FindUser'),
      }, {
        path: '/Home/UpdateUser',
        component: () => import('@/views/User/UpdateUser'),
      }, {
        path: '/Home/RegisterUsers',
        component: () => import('@/views/User/RegisterUser'),
      }, {
        path: '/Home/AssistantInfo',
        component: () => import('@/views/Assistant/AssistantInfo'),
      }, {
        path: '/Home/FindAssistant',
        component: () => import('@/views/Assistant/FindAssistant'),
      }, {
        path: '/Home/RegisterAssistant',
        component: () => import('@/views/Assistant/RegisterAssistant'),
      }, {
        path: '/Home/OlderInfo',
        component: () => import('@/views/Older/OlderInfo'),
      }, {
        path: '/Home/FindOlderInfo',
        component: () => import('@/views/Older/FindOlderInfo'),
      }, {
        path: '/Home/RegisterOlder',
        component: () => import('@/views/Older/RegisterOlder'),
      }, {
        path: '/Home/BedInfo',
        component: () => import('@/views/Bed/BedInfo'),
      }, {
        path: '/Home/Quest1',
        component: () => import('@/views/Quest'),
      }, {
        path: '/Home/InQuestionUser',
        component: () => import('@/views/InsertQuest'),
      }, {
        path: '/Home/UnuseBed',
        component: () => import('@/views/Bed/UnuseBed'),
      }, {
        path: '/Home/SundayList',
        component: () => import('@/views/Assistant/SundayList'),
      },
    ]
  },
  {
    path: '/OlderHome',
    component: () => import('@/views/Older/OlderHome'),
    children: [
      {
        path: '/OlderHome/UpdatePwd',
        component: () => import('@/views/Older/UpdatePwd'),
      }, {
        path: '/OlderHome/OlderInfo',
        component: () => import('@/views/Older/SelfInfo'),
      }, {
        path: '/OlderHome/Question',
        component: () => import('@/views/Quest'),
      }, {
        path: '/OlderHome/InQuestion',
        component: () => import('@/views/InsertQuest'),
      },

    ]
  },
  {
    path: '/xin',
    component: () => import('@/views/xin'),
  },
  {
    path: '/test',
    component: () => import('@/views/test'),
  },
  {
    path: '/dead',
    component: () => import('@/views/dead'),
  },
  {
    path: '/*',
    component: () => import('@/views/NotFound'),
  }
]

const router = new VueRouter({
  mode: 'history',
  //base: process.env.BASE_URL,
  routes
})

export default router
